package com.challenge.smsdao.dormitorymanage.domain;

import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.challenge.smsbase.Domain.BaseEntity;

import javax.persistence.*;
import java.util.List;

/**
 * louzhiqiang
 */
@Entity
public class Apartment extends BaseEntity<Long> {
    @Column
    private String name;

    @JsonIgnoreProperties("apartment")
    @OneToMany(mappedBy = "apartment",cascade = {CascadeType.REMOVE,CascadeType.REFRESH},fetch = FetchType.LAZY)
    private List<Dormitory> dormitories;

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public List<Dormitory> getDormitories() {
        return dormitories;
    }

    public void setDormitories(List<Dormitory> dormitories) {
        this.dormitories = dormitories;
    }
}
